﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace Alfa.Common.ValidationRules {
	public class StringMinLengthValidationRule : ValidationRuleBase {
		public StringMinLengthValidationRule( ) { }

		public long Min { get; set; }

		public override ValidationResult Validate(object value, CultureInfo cultureInfo) {
			if (value is string) {
				if (((string)value).Length < Min) {
					return this.ParseError(false, Messages.PleaseEnterANumberGreaterThan + Min.ToString( ) + ".");
				}
			}

			return this.ParseError(true, null);
		}
	}
}
